package com.lzc.blog.admin.controller;

import com.lzc.blog.admin.model.params.PageParam;
import com.lzc.blog.admin.pojo.SysUser;
import com.lzc.blog.admin.service.SysUserService;
import com.lzc.blog.admin.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sysUser")
public class SysUserController {
    @Autowired
    private SysUserService sysUserService;
    @PostMapping("/sysUserList")
    public Result sysUserList(@RequestBody PageParam pageParam){
        Result result = sysUserService.sysUserList(pageParam);
        return result;
    }
    @GetMapping("/select/{id}")
    public Result selectById(@PathVariable String id){
       SysUser user = sysUserService.selectById(id);
        return Result.success(user);
    }

    @GetMapping("/delete/{id}")
    public Result delete(@PathVariable String id){
        Result result = sysUserService.delete(id);
        return result;
    }

    @PostMapping("/update")
    public Result delete(@RequestBody SysUser user){
        Result result = sysUserService.updateById(user);
        return result;
    }

}
